/******************************************************************************
 * Copyright (C) 2024 EternalChip, Inc.(Gmbh) or its affiliates.
 * 
 * All Rights Reserved.
 * 
 * @file bsp_key.h
 * 
 * @par dependencies 
 * - stdio.h
 * - stdint.h
 * 
 * @author Cuihan
 * 
 * @brief Provide the HAL APIs of AHT21 and corresponding opetions.
 * 
 * Processing flow:
 * 
 * call directly.
 * 
 * @version V1.0 2024-12-24
 *
 * @note 1 tab == 4 spaces!
 * 
 *****************************************************************************/

#ifndef __BSP_KEY_H__  //Avoid repeated including same files later
#define __BSP_KEY_H__

//******************************** Includes *********************************//

// #include "ec_bsp_aht21_reg.h"      // 包含自己的寄存器.h文件一定是在最开始

#include <stdint.h>               // 编译器提供的通用库包含部分
#include <stdio.h>

//******************************** Includes *********************************//

typedef enum
{
  KEY_OK                = 0,            /* Operation completed successfully.  */
  KEY_ERROR             = 1,            /* Run-time error without case matched*/
  KEY_ERRORTIMEOUT      = 2,            /* Operation failed with timeout      */
  KEY_ERRORRESOURCE     = 3,            /* Resource not available.            */
  KEY_ERRORPARAMETER    = 4,            /* Parameter error.                   */
  KEY_ERRORNOMEMORY     = 5,            /* Out of memory.                     */
  KEY_ERRORISR          = 6,            /* Not allowed in ISR context         */
  KEY_RESERVED          = 0x7FFFFFFF    /* Reserved                           */
} key_status_t;

typedef enum
{
  KEY_PRESSED            = 0,           /* Operation completed successfully.  */
  KEY_NOT_PRESSED        = 1,           /* Run-time error without case matched*/
} key_press_status_t;

//******************************** Declaring ********************************//

key_status_t key_scan(key_press_status_t * key_value); 

//******************************** Declaring ********************************//

#endif // __BSP_KEY_H__